﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL_V1.App_Code.DBBroker;
using EntityObjects;

namespace BAL.Controller
{
    public class AssignStationeryItemsControl
    {
        DisbursementDBBroker disbursementRef;
        EmployeeDBBroker employeeRef;
        RequisitionDBBroker requisitionRef;
        DepartmentDBBroker departmentRef;

        public AssignStationeryItemsControl()
        {
            disbursementRef = DisbursementDBBroker.getDisbursementDBBroker();
            employeeRef = EmployeeDBBroker.getEmployeeDBBroker();
            requisitionRef = RequisitionDBBroker.getRequisitionDBBroker();
            departmentRef = DepartmentDBBroker.getDepartmentDBBroker();
        }

        public List<DisbursementCatalogue> getDisbursementListForDept(String empId)
        {
            List<DisbursementCatalogue> disbursement_list = new List<DisbursementCatalogue>();
            disbursement_list = disbursementRef.getDisbursementListForDept(empId);
            return disbursement_list;
        }

        public List<Employee> selectEmployeeByDept(String depId)
        {
           List<Employee> emp_list=new List<Employee>();
           emp_list=employeeRef.selectEmployeeByDept(depId);
           return emp_list;
        }

        public List<Employee> getRequestedEmployee(String itemId,String deptId)
        {
            List<Employee> emp_list = new List<Employee>();
            emp_list = employeeRef.getRequestedEmployee(itemId,deptId);
            return emp_list;
        }
        public int getCurrentWeekRequestedQtyToAssignToEmp(String empId, String itemId)
        {
            int reqQty;
            reqQty = requisitionRef.getCurrentWeekRequestedQtyToAssignToEmp(empId, itemId);
            return reqQty;
        }


        public int getOutstandingQtyToAssignToEmp(String empId, String itemId)
        {
            int outStandingQty;
            outStandingQty = requisitionRef.getOutstandingQtyToAssignToEmp(empId, itemId);
            return outStandingQty;
        }

        public int updateRequisition(Requisition rq, int Id)
        {
            int update_req;
            update_req = requisitionRef.updateRequisition(rq, Id);
            return update_req;
        }


        public int updateRequisitionDetails(RequisitionDetails rqDetails, int formId, String itemId)
        {
            int update_req_details;
            update_req_details = requisitionRef.updateRequisitionDetails(rqDetails, formId, itemId);
            return update_req_details;
        }

        public Requisition getRequsitionByEmpIdAndApprovedStatus(String empId)
        {
            Requisition requisition;
            requisition = requisitionRef.getRequsitionByEmpIdAndApprovedStatus(empId);
            return requisition;
        }
        public RequisitionDetails getReqDetailsByFormId(int id, string itemid)
        {
            return requisitionRef.selectRequisitionDetails(id, itemid);
        }      
        
        public List<Department> getAllDepartment()
        {
            return departmentRef.selectAllDepartment();
        }

        public Department getDepartmentByRepId(String repId)
        {
            Department dep = new Department();
            dep = departmentRef.getDepartmentByRepId(repId);
            return dep;
        }

        public List<Requisition> getRequisitionByDeptIdAndApprovedStatus(String deptId)
        {
           return requisitionRef.getRequisitionByDeptIdAndApprovedStatus(deptId);
        }

        public RequisitionDetails getRequisitionDetails(int reqFormId, String itemId)
        {
            return requisitionRef.selectRequisitionDetails(reqFormId, itemId);
        }
    }
}
